package com.milk.system.controller;

import com.milk.system.common.result.PageResult;
import com.milk.system.common.result.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.milk.system.model.form.CommentsForm;
import com.milk.system.model.query.CommentsPageQuery;
import com.milk.system.model.vo.CommentsPageVO;
import com.milk.system.service.CommentsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;


/**
 * 评论管理表 前端控制器
 *
 * @author milk
 * @since 2024-05-04
 */
@Tag(name = "评论管理表接口")
@RestController
@RequestMapping("/api/comments")
@RequiredArgsConstructor
public class CommentsController {

        private final CommentsService commentsService;

        @Operation(summary = "评论管理表分页列表")
        @GetMapping("/page")
        public PageResult<CommentsPageVO> listPagedCommentss(CommentsPageQuery queryParams ) {
            IPage<CommentsPageVO> result = commentsService.listPagedCommentss(queryParams);
            return PageResult.success(result);
        }

        @Operation(summary = "删除评论管理表")
        @DeleteMapping("/{ids}")
        public Result deleteCommentss(
            @Parameter(description = "评论管理表ID，多个以英文逗号(,)分割") @PathVariable String ids) {
            boolean result = commentsService.deleteCommentss(ids);
            return Result.judge(result);
        }
}
